package com.mengtian_tech.tju.dataquery.api.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.mengtian_tech.tju.dataquery.api.config.interceptors.AjaxInterceptor;

/**
 * 用于配置拦截ajax请求的filter
 * @author wxd56
 */
@Configuration
public class AjaxFilter implements WebMvcConfigurer {

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		// 配置第一个拦截器，仅对/api/**路径下的请求生效
		registry.addInterceptor(new AjaxInterceptor()).addPathPatterns("/api/**");
	}

}
